package com.zh.zhbootcommon.config.job;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.stereotype.Component;

/**
 * 描述: BEAN模式（类形式）
 * 注意点：继承IJobHandler类，添加注解@JobHandler(value = "testJobHandler")
 *
 * @author: yanglin
 * @Date: 2021-11-17-11:49
 * @Version: 1.0
 */
@Component
public class BeanClassJobHandler extends IJobHandler {

    /**
     * 基于类开发的任务需要手动注册到执行器工厂，具体代码如下所示：
     * XxlJobSpringExecutor.registJobHandler("beanClassJobHandler", new BeanClassJobHandler());
     * @param s
     * @return
     * @throws Exception
     */
    @Override
    public ReturnT<String> execute(String s) throws Exception {
        XxlJobLogger.log("BEAN模式（类形式） running...{}", s);
        return ReturnT.SUCCESS;
    }
}
